package com.hxzy.tms.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import junit.framework.TestCase;

public class AbstractTestCase extends TestCase {
    protected transient Logger logger = LoggerFactory.getLogger(getClass());

    private ApplicationContext applicationContext;

    public AbstractTestCase() {

    }

    protected ApplicationContext getApplicationContext() {
        if (applicationContext == null) {
            applicationContext = new ClassPathXmlApplicationContext(configLocations());
        }
        return applicationContext;
    }

    protected Object getBean(String name) {
        return getApplicationContext().getBean(name);
    }

    protected String[] configLocations() {
        return new String[] { "applicationContext-dao.xml", "applicationContext-service.xml" ,"applicationContext-tx.xml" };
    }
}
